@extends('layouts.app')

@section('title', $page->title)

@section('content')
<div class="container py-4">
    <!-- Breadcrumb -->
    <nav aria-label="breadcrumb" class="mb-4">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{ route('home') }}">首页</a></li>
            <li class="breadcrumb-item"><a href="{{ route('pages.index') }}">页面</a></li>
            <li class="breadcrumb-item active" aria-current="page">{{ $page->title }}</li>
        </ol>
    </nav>

    <div class="row">
        <!-- Main Content -->
        <div class="col-lg-8 mx-auto">
            <article>
                <!-- Page Header -->
                <header class="mb-4">
                    <h1 class="display-5 fw-bold mb-3">{{ $page->title }}</h1>
                    
                    <!-- Page Meta -->
                    <div class="post-meta mb-3">
                        <span class="me-3">
                            <i class="bi bi-calendar"></i> 更新于 {{ $page->updated_at->format('Y年m月d日') }}
                        </span>
                        <span class="me-3">
                            <i class="bi bi-person"></i> {{ $page->user->name }}
                        </span>
                        @if($page->template && $page->template !== 'default')
                            <span class="me-3">
                                <i class="bi bi-file-earmark"></i> {{ $page->template }}
                            </span>
                        @endif
                    </div>
                </header>

                <!-- Page Content -->
                <div class="page-content">
                    {!! $page->content !!}
                </div>
            </article>

            <!-- Back to List -->
            <div class="border-top pt-4 mt-5 text-center">
                <a href="{{ route('pages.index') }}" class="btn btn-outline-primary">
                    <i class="bi bi-arrow-left"></i> 返回页面列表
                </a>
            </div>
        </div>
    </div>
</div>

@push('styles')
<style>
.page-content {
    line-height: 1.8;
}
.page-content h1, .page-content h2, .page-content h3, 
.page-content h4, .page-content h5, .page-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}
.page-content p {
    margin-bottom: 1.5rem;
}
.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
}
.page-content blockquote {
    border-left: 4px solid #0d6efd;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
}
.page-content code {
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}
.page-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
}
.page-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}
.page-content table th,
.page-content table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}
.page-content table th {
    background-color: #f8f9fa;
    font-weight: 600;
}
</style>
@endpush
@endsection